import Vue from 'vue'
import Router from 'vue-router'

Vue.use(Router)

// 解决Uncaught (in promise) NavigationDuplicated: Avoided redundant navigation to current location:
//使用编程式路由实现跳转的时候，多次执行会抛出NavigationDuplicated的警告错误是因为"vue-router"3版本之后 底层引入了promise,而通过声明式导航没有出现此类问题是因为vue-router底层已经处理好了。
const originalPush = Router.prototype.push
Router.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err)
}

export default new Router({
  // 路由
  routes: [
    {
      // 登录页
      path: '/',
      name: 'Login',
      component: () => import('@/components/login/Login.vue')
    },
    {
      path: '/register',
      name: 'Register',
      component: () => import('@/components/login/Register.vue'),
    },
    {
      path: '/register2',
      name: 'Register2',
      component: () => import('@/components/login/Register2.vue'),
    },
    {
      path: '/403',
      name: '403',
      component: () => import('@/components/exception/403.vue')
    },
    {
      path: '/404',
      name: '404',
      component: () => import('@/components/exception/404.vue'),
    },
    {
      path: '/500',
      name: '500',
      component: () => import('@/components/exception/500.vue'),
    },
    {
      path: '/toVideoPlaybackNoBorder',
      name: 'toVideoPlaybackNoBorder',
      component: () => import('@/components/toolbox/VideoPlaybackNoBorder.vue'),
    },
    {
      path: '/toPdfView',
      name: 'toPdfView',
      component: () => import('@/components/toolbox/PdfView.vue'),
    },
    {
      path: '/toPdfView2',
      name: 'toPdfView2',
      component: () => import('@/components/toolbox/PdfView2.vue'),
    },
    {
      path: '/toHomeworkView',
      name: 'toHomeworkView',
      component: () => import('@/components/education/HomeworkView.vue'),
    },
    {
      // 系统首页
      path: '/home',
      name: 'Home',
      component: () => import('@/components/home/Home.vue'),
      // 默认页面
      redirect: '/index',
      // 用于父页面进行切换的子路由
      children: [
        {
          // 首页的第一个页面
          path: '/index',
          name: 'Index',
          component: () => import("@/components/home/Index.vue")
        },
        {
          path: '/toDict',
          component: () => import("@/components/sys/DictGroupList.vue")
        },
        {
          path: '/config',
          name: 'config',
          component: () => import('@/components/sys/ConfigList.vue'),
        },
        {
          path: '/bookList',
          name: 'bookList',
          component: () => import('@/components/collect/BookList'),
        },
        {
          path: '/musicList',
          name: 'musicList',
          component: () => import('@/components/collect/MusicList'),
        },
        {
          path: '/softwareList',
          name: 'SoftwareList',
          component: () => import('@/components/collect/SoftwareList.vue'),
        },
        {
          path: '/websiteList',
          name: 'WebsiteList',
          component: () => import('@/components/collect/WebsiteList.vue'),
        },
        {
          path: '/gameList',
          name: 'GameList',
          component: () => import('@/components/collect/GameList.vue'),
        },
        {
          path: '/shoppingCartList',
          name: 'ShoppingCartList',
          component: () => import('@/components/collect/ShoppingCartList.vue'),
        },
        {
          path: '/toGetMemberFamilyAll',
          name: 'toGetMemberFamilyAll',
          component: () => import('@/components/member/MemberFamilyAll.vue'),
        },
        {
          path: '/toSolarToLunarPage',
          name: 'toSolarToLunarPage',
          component: () => import('@/components/toolbox/SolarToLunar.vue'),
        },
        {
          path: '/toPasswordGeneration',
          name: 'PasswordGeneration',
          component: () => import('@/components/toolbox/PasswordGeneration.vue'),
        },
        {
          path: '/toPasswordManagement',
          name: 'PasswordManagement',
          component: () => import('@/components/coffer/PasswordManagementList.vue'),
        },
        {
          path: '/toEventList',
          name: 'toEventList',
          component: () => import('@/components/member/EventList.vue'),
        },
        {
          path: '/toVideoPlayback',
          name: 'toVideoPlayback',
          component: () => import('@/components/toolbox/VideoPlayback.vue'),
        },
        {
          path: '/toLiveBroadcast',
          name: 'toLiveBroadcast',
          component: () => import('@/components/toolbox/LiveBroadcast.vue'),
        },
        {
          path: '/toBirthdayList',
          name: 'toBirthdayList',
          component: () => import('@/components/socialize/BirthdayList.vue'),
        },
        {
          path: '/toSocialConnectionList',
          name: 'toSocialConnectionList',
          component: () => import('@/components/member/SocialConnectionList.vue'),
        },
        {
          path: '/toAppellationCalculation',
          name: 'AppellationCalculation',
          component: () => import('@/components/member/AppellationCalculation.vue'),
        },
        {
          path: '/toRelationGraphLine',
          name: 'RelationGraphLine',
          component: () => import('@/components/member/diagram/RelationGraphLine.vue'),
        },
        {
          path: '/toUserSaveUpd',
          name: 'UserSaveUpd',
          component: () => import('@/components/member/UserSaveUpd.vue'),
        },
        {
          path: '/toRelationGraphLineImages',
          name: 'RelationGraphLineImages',
          component: () => import('@/components/member/diagram/RelationGraphLineImages.vue'),
        },
        {
          path: '/toMoviesList',
          name: 'MoviesList',
          component: () => import('@/components/collect/MoviesList.vue'),
        },
        {
          path: '/toNotepad',
          name: 'NotepadList',
          component: () => import('@/components/scheduledTask/NotepadList.vue'),
        },
        {
          path: '/toJotDownList',
          name: 'JotDownList',
          component: () => import('@/components/scheduledTask/JotDownList.vue'),
        },
        {
          path: '/toBillingGroup',
          name: 'BillingGroupList',
          component: () => import('@/components/bill/BillingGroupList.vue'),
        },
        {
          path: '/toBillList',
          name: 'BillList',
          component: () => import('@/components/bill/BillList.vue'),
        },
        {
          path: '/toMonthlyBill',
          name: 'MonthlyBill',
          component: () => import('@/components/bill/MonthlyBill.vue'),
        },
        {
          path: '/toCustomBill',
          name: 'CustomBill',
          component: () => import('@/components/bill/CustomBill.vue'),
        },
        {
          path: '/toYearBill',
          name: 'YearBill',
          component: () => import('@/components/bill/YearBill.vue'),
        },
        {
          path: '/toTotalBill',
          name: 'TotalBill',
          component: () => import('@/components/bill/TotalBill.vue'),
        },
        {
          path: '/toWordGroupList',
          name: 'WordGroupList',
          component: () => import('@/components/education/WordGroupList.vue'),
        },
        {
          path: '/toHomework',
          name: 'toHomework',
          component: () => import('@/components/education/HomeworkList.vue'),
        },
        {
          path: '/toAboutUs',
          name: 'AboutUs',
          component: () => import('@/components/sys/AboutUs.vue'),
        },
        {
          path: '/toTombList',
          name: 'TombList',
          component: () => import('@/components/member/TombList.vue'),
        },
        {
          path: '/toPlanList',
          name: 'PlanList',
          component: () => import('@/components/scheduledTask/PlanList.vue'),
        },
        {
          path: '/toPlanOverdueList',
          name: 'PlanOverdueList',
          component: () => import('@/components/scheduledTask/PlanOverdueList.vue'),
        },
        {
          path: '/toPlanTodayList',
          name: 'PlanTodayList',
          component: () => import('@/components/scheduledTask/PlanTodayList.vue'),
        },
        {
          path: '/toPlanSaveUpd',
          name: 'PlanSaveUpd',
          component: () => import('@/components/scheduledTask/PlanSaveUpd.vue'),
        },
        {
          path: '/toPlanCompletedList',
          name: 'PlanCompletedList',
          component: () => import('@/components/scheduledTask/PlanCompletedList.vue'),
        },
        {
          path: '/toMenstruationList',
          name: 'MenstruationList',
          component: () => import('@/components/coffer/MenstruationList.vue'),
        },
        {
          path: '/toGrowthRecord',
          name: 'GrowthRecord',
          component: () => import('@/components/education/GrowthRecord.vue'),
        },
        {
          path: '/toLearningPlan',
          name: 'LearningPlan',
          component: () => import('@/components/education/LearningPlan.vue'),
        },
        {
          path: '/toDynamicRecordingList',
          name: 'DynamicRecordingList',
          component: () => import('@/components/toolbox/DynamicRecordingList.vue'),
        },
        {
          path: '/toDynamicDataDetailedList',
          name: 'DynamicDataDetailedList',
          component: () => import('@/components/toolbox/DynamicDataDetailedList.vue'),
        },
        {
          path: '/toQuickImportOfMusic',
          name: 'toQuickImportOfMusic',
          component: () => import('@/components/toolbox/QuickImportOfMusic.vue'),
        },
        {
          path: '/toPdfViewList',
          name: 'toPdfViewList',
          component: () => import('@/components/toolbox/PdfViewList.vue'),
        },
        {
          path: '/toDruid',
          name: 'toDruid',
          component: () => import('@/components/sys/Druid.vue'),
        },
        {
          path: '/toTaskSignList',
          name: 'toTaskSignList',
          component: () => import('@/components/coffer/TaskSignList.vue'),
        },
        {
          path: '/toTaskSignDetailedList',
          name: 'TaskSignDetailedList',
          component: () => import('@/components/coffer/TaskSignDetailedList.vue'),
        },
        {
          path: '/toBookAnalyst',
          name: 'BookAnalyst',
          component: () => import('@/components/statistics/BookAnalyst.vue'),
        },
      ],
    },


    // {
    //   path: '/home',
    //   name: 'Home',
    //   component: Home,
    //   children:[
    //     {
    //       path: '/initHome',
    //       name: 'InitHome',
    //       component: InitHome
    //     },
    //     {
    //       path: '/dataSourceManagement',
    //       name: 'DataSourceManagement',
    //       component: DataSourceManagement
    //     },
    //   ]
    // },
    // {
    //   path: '/login',
    //   name: 'Login',
    //   component: LoginForm,
    // },
  ]
})
